/**
 * Created by hehe on 2015/7/21.
 */
var BaseParser = require('./BaseParser').BaseParser;

function XieChengParser(option) {
    this.filePath = option.filePath;
}
XieChengParser.prototype = new BaseParser(this);

//    this.constructor.prototype.verifyData();
XieChengParser.prototype.parserToOrder = function (batchID, arr) {
    if(!arr[0] || arr[0]==''|| arr[0]==undefined||!arr[1] || arr[1]==''|| arr[1]==undefined || isNaN(arr[4])){
        return undefined;
    }

    var self = this,order = new Object();
    order.batchID = batchID;

    order.placeOrderTime = self.parseDate(arr[11]);

    order.channelCompanyName = '携程';
    order.channelsOrderNo = arr[0];
    order.expressRecipient = arr[1];
    order.expressRecipientTel = arr[2];
    order.deviceQuantity = parseInt(arr[4]);

    order.leaseBeginTime =  self.parseDate(arr[5]);
    order.receiveAddress = arr[8];
    order.leaseDayNumber = arr[7];

    order.leaseEndTime = self.parseDate(arr[6]);

    order.restitutionAddress = arr[9];
    order.foregift = arr[17];
    order.orderReamk1 = arr[14]+arr[15];

//    order.foregitStatus = arr[14];
//
//    try{
//        order.takeAwayTime = new Date(arr[7]+arr[9]);
//    }catch (err){
//
//    }

    order.processingMode;
    order.rentMachineOrderNo;
    order.orderStatus;
    order.orderReamk2;
    order.orderReamk3;
    order.orderReamk4;
    order.cancelDescription;
    order.sku;
    order.deviceType;
    order.paymentMehtod;
    order.destination;
    order.unitPrice;
    order.expectedRent;
    order.actualRent;
    order.totalRent;
    order.exWareHouseTime;
    order.renewal;
    order.renewalTime;
    order.sn;
    order.accounts;
    order.skyroamID;
    order.channelNo;
    order.deliveryWay;
    order.deliveryPlace;
    order.orderAirport;
    order.expressCompany;
    order.expressPickUpTime;
    order.expressNo;
    order.expressServiceTime;

    order.currency;
    order.checkedStatus;
    order.processingModel
    order.deductForegift;
    order.deductForegiftDescription;
    order.dedcutForegitftTime;
    return order;
}


exports.XieChengParser = XieChengParser;
